<?php

/**
 * This file is part of the Framework03 PHP framework.
 * @author Walter Tamboer
 * @package Framework03
 */


abstract class FW_Http_Adapter_Abstract
{
    /**
     * Connects to the given host on the given port number.
     * @param string $host The host to connect to.
     * @param int $port The port number to connect to.
     * @param bool $secure Whether or not we're connecting via a secure connection.
     */
    abstract public function connect($host, $port, $secure);

    /**
     * Closes the current connection.
     */
    abstract public function disconnect();

    /**
     * Sends a request to the remote server.
     * @param string $method The method to use.
     * @param FW_Uri_Abstract $uri The URI of this request.
     * @param string $version The HTTP version to use.
     * @param array $headers The HTTP headers to send.
     * @param string $body The body of the request.
     */
    abstract public function write($method, FW_Uri_Abstract $uri, $version = FW_Http_Request::HTTP_1_1, $headers = array(), $body = '');

    /**
     * Reads a response from the server.
     * @return string
     */
    abstract public function read();
}
